package com.bdqn.gulimall.product;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.redisson.api.RedissonClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.UUID;

@SpringBootTest
@RunWith(SpringRunner.class)
public class test {

    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Resource
    private RedissonClient redissonClient;

    @Test
    public void testRedis(){
        ValueOperations<String, String> ops = stringRedisTemplate.opsForValue();
        ops.set("hello","你好"+ UUID.randomUUID().toString());

        System.out.println(ops.get("hello"));


    }

    @Test
    public void redisson(){
        System.out.println(redissonClient);
    }

    @Test
    public void getIP() throws UnknownHostException {
        InetAddress[] allByName = InetAddress.getAllByName("www.madagaga.top");
        System.out.println(allByName[0].getHostAddress());
    }
}
